package main

import (
	"log"
	"os"

	"gitee.com/xuender/ds/app"
)

func main() {
	// const url = "http://quote.eastmoney.com/center/hszs.html"
	const url2 = "http://www.weather.com.cn/"

	s := app.NewWebService()
	// s.GetPage(url2)
	log.Println(url2)
	// s.GetPage(url)
	// log.Println(url)
	// for i := 0; i < 3; i++ {
	// 	f, _ := os.Create(fmt.Sprintf("gp%d.png", i))
	// 	defer f.Close()
	// 	log.Printf("i: %d", i)
	// 	time.Sleep(5 * time.Second)
	// 	f.Write(s.Screenshot(url, "body > div.page-wrapper > div.page-header > div:nth-child(5) > div > div"))
	// }

	// time.Sleep(5 * time.Second)
	f, _ := os.Create("tq.png")
	defer f.Close()
	_, _ = f.Write(s.Screenshot(url2, "body > div.xyn-bjbox > div.nav_fa > div.header-box > div > div.w_weather"))
}
